var a = getApp();

Page({
    data: {
        language: "",
        mainInfo: "",
        cost_money: "",
        money_total: "",
        order_amount: "",
        order_count: "",
        supplier_id: "",
        mid: "",
        insuclShow: !1
    },
    onLoad: function(a) {
        a.uid && this.setData({
            mid: a.uid
        });
    },
    onReady: function() {
        var a = wx.getStorageSync("langIndex");
        this.setData({
            language: a.en
        });
    },
    onShow: function() {
        this._initData(), this._getSupplierInfo(), this.isShowdetail();
    },
    isShowdetail: function() {
        var t = this, e = a.getNetAddresss("plugin.supplier.frontend.index.policyControl");
        a._getNetWork({
            url: e,
            success: function(a) {
                var e = a.data;
                console.log(e), 1 == e.result ? 1 == e.data ? t.setData({
                    insuclShow: !0
                }) : 0 == e.data && t.setData({
                    insuclShow: !1
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    onShareTimeline: function() {},
    onChange: function(a) {
        this.setData({
            activeNames: a.detail
        });
    },
    _getSupplierInfo: function() {
        var t = this, e = a.getNetAddresss("plugin.supplier.frontend.index.index"), n = {
            member_id: this.data.mid
        };
        a._postNetWork({
            url: e,
            showToastIn: !1,
            data: n,
            success: function(a) {
                var e = a.data;
                1 == e.result ? t.setData({
                    supplier_id: e.data.data.supplier_id,
                    cost_money: e.data.data.cost_money,
                    money_total: e.data.data.money_total,
                    order_amount: e.data.data.order_amount,
                    order_count: e.data.data.order_count,
                    mainInfo: e.data.data.member_model,
                    supplierSet: e.data.data.set
                }) : wx.navigateTo({
                    url: "/packageA/member/supplier/supplier"
                });
            },
            fail: function(a) {
                wx.showToast({
                    icon: "none",
                    title: a,
                    duration: 1500
                });
            }
        });
    },
    goToInfo: function(a) {
        var t = a.currentTarget.dataset.num;
        "1" === t ? wx.navigateTo({
            url: "/packageA/member/supplier/SupInfoManage/SupInfoManage?member_id=" + this.data.mid
        }) : "2" === t ? wx.navigateTo({
            url: "/packageA/member/supplier/CommodityManagement/CommodityManagement?store_id=" + this.data.supplier_id + "&store=supplier"
        }) : "3" === t ? wx.navigateTo({
            url: "/packageA/member/myOrder_v2/myOrder_v2?status=0&orderType=supplier"
        }) : "4" === t ? wx.navigateTo({
            url: "/packageA/member/presentationRecord_v2/presentationRecord_v2?orderType=supplier&member_id=" + this.data.mid
        }) : "5" === t ? wx.navigateTo({
            url: "/packageA/member/balance/balance_withdrawals/balance_withdrawals?supplier=supplier&member_id=" + this.data.mid
        }) : "6" === t && wx.navigateTo({
            url: "/packageD/warranty/warrantyind/warrantyind"
        });
    },
    _initData: function() {
        this.setData({
            mainInfo: "",
            cost_money: "",
            money_total: "",
            order_amount: "",
            order_count: "",
            supplier_id: ""
        });
    }
});